# coding:utf-8

import multiprocessing
import os
import time

"""

"""


def work_a():
    for i in range(10):
        print(i, 'a', os.getpid())
        time.sleep(1)


def work_b():
    for i in range(10):
        print(i, 'b', os.getpid())
        time.sleep(1)


if __name__ == '__main__':
    # start = time.time()
    # work_a()
    # work_b()
    # end = time.time()
    # print(end - start)
    # print('parent pid is : %s' % os.getpid())

    a_p = multiprocessing.Process(target=work_a)
    b_p = multiprocessing.Process(target=work_b)
    # a_p.start()
    # b_p.start()
    # a_p.join()
    # b_p.join()

    for p in (a_p, b_p):
        p.start()

    for p in (a_p, b_p):
        p.join()

    print('parent pid is : %s' % os.getpid())
